<!--首页-->

<template>
  <!--路由-->
  <RouterView />
  <!--顶部---->
  <van-sticky>
    <Wrapper></Wrapper>
  </van-sticky>
  <!--图标区域---->
  <Icons></Icons>
  <!--轮播区域-->
  <SwipeCom></SwipeCom>
  <!--商家-->
  <Nearby></Nearby>
  <!--底部-->
  <div style="margin-top: 40px;">
    <van-tabbar v-model="active">
      <van-tabbar-item icon="home-o" @click="$router.push('/')">首页</van-tabbar-item>
      <van-tabbar-item icon="search" @click="$router.push('/search')">搜索</van-tabbar-item>
      <van-tabbar-item icon="bill" @click="$router.push('/order')">订单</van-tabbar-item>
      <van-tabbar-item icon="manager-o" @click="$router.push('/user')">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script setup>
import Wrapper from "./Wrapper.vue";
import Icons from "./Icons.vue";
import SwipeCom from "./SwipeCom.vue";
import Docker from "./Docker.vue";
import Nearby from "./Nearby.vue";

import { RouterLink, RouterView } from "vue-router";
import http from "@/utils/request.js";
import { useRouter } from "vue-router";

const router = useRouter();

// const active = ref(0);
// function toSearchView() {
//   router.push("/serch");
// }
//获取个人信息
const getUserInfo = function () {
  http
    .get("/user/info", {
      //headers: { "auth-token": localStorage.getItem("token") }, //请求拦截器中配置后，这里不用再配置
    })
    .then(function (res) {
      console.log("获取到的个人信息:", res.data);
      if (res.data.resCode === "200") {
        console.log("请求成功！");
      }
      // else{
      //   console.log("请求失败！")
      // }
    });
};

getUserInfo(); //测试：获取个人用户信息；
</script>
